﻿@model EvalResultVM
@{
    ViewData["Title"] = "评价结果";
}
@section Css{
@*<link rel="stylesheet" href="~/css/student.css" asp-append-version="true">*@
<link rel="stylesheet" href="~/css/assessment.css" asp-append-version="true">
}
<div class="content" style="overflow-y:auto;">
    <h2>该生对您的细节评价如下：</h2>


    <div class="sum" style="font-size:30px;">
        <p>本次的评测结果为 <span> @Model.Score </span> 分</p>
    </div>

    <div class="content-table">
        @await Html.PartialAsync("QuestionsTable")
    </div>

    <div class="input-group mb-3" style="width:80%;margin: 0 auto;margin-top:50px;height:80px;">
        <input id="input_comment" type="text" class="form-control" placeholder="评论信息" aria-label="评论信息" aria-describedby="button-addon2">
        <a class="btn btn-outline-secondary" id="send_comment">发送</a>
    </div>

    @await Html.PartialAsync("Comment")
</div>

@section Scripts{
@*<script src="~/lib/angular/angular.js"></script>*@
@*<script src="~/js/teacher_result.js" asp-append-version="true"></script>*@

<script>
    $(function(){
        var scId = getQueryVariable('scid');
        var sid = getQueryVariable('sid');

        // 提交评教
        $("#send_comment").click(function(){
                let rid = sid;
                let content = $("#input_comment").val();
                let data = {scId, rid, content};
                $.post("/api/Comment/Add",data,function(res,status,xhr){
                    if(res.suc && res.data > 0){
                        alert("提交成功");
                        $("#input_comment").val('');
                        window.location.reload();
                    }else{
                        console.log(res,status);
                    }
                });
        });

        // 获取query
         function getQueryVariable(key)
        {
           var query = window.location.search.substring(1);
           var vars = query.split("&");
           for (let i=0;i<vars.length;i++) {
                   var pair = vars[i].split("=");
                   if(pair[0] === key){return pair[1];}
           }
           return false;
        }
    });
</script>
}
